﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xc.DataAccess.Core;
using Xc.DataAccess.Protocoals.WaterMeters.Models.Requests;
using Xc.DataAccess.Protocoals.WaterMeters.Services;

namespace Xc.DataAccess.Protocoals.WaterMeters.Extensions
{
    public static class MeterHandleServiceExtension
    {
        /// <summary>
        /// 获取表计数据
        /// </summary>
        /// <param name="meterHandleService"></param>
        /// <param name="getMeterDataFrameRequest"></param>
        /// <returns></returns>
        public static async Task<ResultData<GetMeterDataRequest, byte[]>> GetMeterData(this IMeterHandleService meterHandleService, GetMeterDataRequest getMeterDataFrameRequest)
        {
            return await meterHandleService.AfterRequest(getMeterDataFrameRequest);
        }
        /// <summary>
        /// 设置表计底数
        /// </summary>
        /// <param name="meterHandleService"></param>
        /// <param name="setMeterValueRequest"></param>
        /// <returns></returns>
        public static async Task<ResultData<SetMeterValueRequest, byte[]>> SetMeterValue(this IMeterHandleService meterHandleService, SetMeterValueRequest setMeterValueRequest)
        {
          return  await meterHandleService.AfterRequest(setMeterValueRequest);
        }
        /// <summary>
        /// 多次卡充值
        /// </summary>
        /// <param name="meterHandleService"></param>
        /// <param name="setMeterMutipleChargeRequest"></param>
        /// <returns></returns>
        public static async Task<ResultData<SetMeterMutipleChargeRequest, byte[]>> SetMeterMutipleCharge(this IMeterHandleService meterHandleService, SetMeterMutipleChargeRequest setMeterMutipleChargeRequest)
        {
           return await meterHandleService.AfterRequest<SetMeterMutipleChargeRequest>(setMeterMutipleChargeRequest);
        }
        /// <summary>
        /// 设置囤积量报警量
        /// </summary>
        /// <param name="meterHandleService"></param>
        /// <param name="setAlarmVolumeRequest"></param>
        /// <returns></returns>
        public static async Task<ResultData<SetAlarmVolumeRequest, byte[]>> SetAlarmVolume(this IMeterHandleService meterHandleService, SetAlarmVolumeRequest setAlarmVolumeRequest)
        {
            return await meterHandleService.AfterRequest(setAlarmVolumeRequest);
        }
        /// <summary>
        /// 获取设备地址
        /// </summary>
        /// <param name="meterHandleService"></param>
        /// <param name="getMeterAddressRequest"></param>
        /// <returns></returns>
        public static async Task<ResultData<GetMeterAddressRequest, byte[]>> GetMeterAddress(this IMeterHandleService meterHandleService, GetMeterAddressRequest getMeterAddressRequest)
        {
            return await meterHandleService.AfterRequest(getMeterAddressRequest);
        }
        /// <summary>
        /// 写关阀
        /// </summary>
        /// <param name="meterHandleService"></param>
        /// <param name="setCloseValveRequest"></param>
        /// <returns></returns>
        public static async Task<ResultData<SetCloseValveRequest, byte[]>> SetCloseValve(this IMeterHandleService meterHandleService, SetCloseValveRequest setCloseValveRequest)
        {
            return await meterHandleService.AfterRequest(setCloseValveRequest);
        }
        /// <summary>
        /// 写开阀
        /// </summary>
        /// <param name="meterHandleService"></param>
        /// <param name="setCloseOpenRequest"></param>
        /// <returns></returns>
        public static async Task<ResultData<SetOpenValveRequest, byte[]>> SetOpenValve(this IMeterHandleService meterHandleService, SetOpenValveRequest setCloseOpenRequest)
        {
            return await meterHandleService.AfterRequest(setCloseOpenRequest);
        }
        /// <summary>
        /// 用户充值指令
        /// </summary>
        /// <param name="meterHandleService"></param>
        /// <param name="setUserChangeRequest"></param>
        /// <returns></returns>
        public static async Task<ResultData<SetUserChangeRequest, byte[]>> SetUserChange(this IMeterHandleService meterHandleService, SetUserChangeRequest setUserChangeRequest)
        {
            return await meterHandleService.AfterRequest(setUserChangeRequest);
        }
        /// <summary>
        /// 表具恢复出厂设置
        /// </summary>
        /// <param name="meterHandleService"></param>
        /// <param name="setRestoreFactoryRequest"></param>
        /// <returns></returns>
        public static async Task<ResultData<SetRestoreFactoryRequest, byte[]>> SetRestoreFactory(this IMeterHandleService meterHandleService, SetRestoreFactoryRequest setRestoreFactoryRequest)
        {
            return await meterHandleService.AfterRequest(setRestoreFactoryRequest);
        }
        /// <summary>
        /// 设置表计地址
        /// </summary>
        /// <param name="meterHandleService"></param>
        /// <param name="setMeterIpAddressRequest"></param>
        /// <returns></returns>
        public static async Task<ResultData<SetMeterIpAddressRequest, byte[]>> SetMeterIpAddress(this IMeterHandleService meterHandleService, SetMeterIpAddressRequest setMeterIpAddressRequest)
        {
            return await meterHandleService.AfterRequest(setMeterIpAddressRequest);
        }
        /// <summary>
        /// 修改上报周期和超时限制
        /// </summary>
        /// <param name="meterHandleService"></param>
        /// <param name="setMeterUploadIntervalRequest"></param>
        /// <returns></returns>
        public static async Task<ResultData<SetMeterUploadIntervalRequest, byte[]>> SetMeterUploadInterval(this IMeterHandleService meterHandleService, SetMeterUploadIntervalRequest setMeterUploadIntervalRequest)
        {
            return await meterHandleService.AfterRequest(setMeterUploadIntervalRequest);
        }
    }
}
